﻿<%@ WebHandler Language="C#" Class="winningInformationFill" %>

using System;
using System.Web;
using OneshoppingWeb;
using OneShoppingModel;
using OneShoppingBLL;
using OneShoppingUtility;
using System.Web.SessionState;


public class winningInformationFill : IHttpHandler, IRequiresSessionState
{
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        try
        {
            int listId = Convert.ToInt32(context.Request["listId"]);
            int tradeId = activitypurchasingViewBLL.GetInstance().GetEntity(r => r.ListId == listId).TradeId;
            ActivityResult activity = ActivityResultBLL.GetInstance().GetEntity(r => r.TradeId == tradeId);
            activity.Address = context.Request["Address"];
            activity.Phone = context.Request["Phone"];
            
            activity.Status = 1;
            activity.IdNumber = context.Request["IdNumber"];

            bool result = ActivityResultBLL.GetInstance().Update(activity);
            if (result)
            {
                context.Response.Write((int)Protocol_activity.UPDATE_RESULT_SUCCESS);
            }
            else
            {
                context.Response.Write((int)Protocol_activity.UPDATE_RESULT_FAIL);
            }
        }
        catch {
            context.Response.Write((int)Protocol_activity.UPDATE_RESULT_FAIL);
        }
        
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}